package com.prj.ufdm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableAsync
public class UfdmFileApplication extends SpringBootServletInitializer implements EnvironmentAware {
	
    private static Environment env;
	
	@Override
	public void setEnvironment(Environment environment) {
		env = environment;
	}
	
	public static void main(String[] args) {
		SpringApplication.run(UfdmFileApplication.class, args); 
		System.out.println("\n Gisv2File " + env.getProperty("server.port") + " 启动成功........"); 
	}
	
	@Bean
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}
	
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
	    return application.sources(UfdmFileApplication.class);
	}

}
